package lesson02;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;

public class Demo_206 {

    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("d:/temp/world.txt");
        Scanner scanner = new Scanner(fileInputStream);
        while (true){
            if (!scanner.hasNextLine()){
                break;
            }
            String line = scanner.nextLine();
            System.out.println(line);
        }
        scanner.close();
        fileInputStream.close();
    }





















    public static void main1(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("d:/temp/test.txt");
        Scanner scanner = new Scanner(fileInputStream,"UTF-8");
        while (true) {

            if (!scanner.hasNextLine()) {
                break;
            } else {
                String line = scanner.nextLine();
                System.out.println(line);
            }
        }
        scanner.close();
        fileInputStream.close();
    }
}
